/*  ----------------------------------------------------------------------------
 *  Arello Mobile
 *  Fast 3d Engine
 *  ----------------------------------------------------------------------------
 * Except where otherwise noted, this work is licensed under
 * http://creativecommons.org/licenses/by/3.0
 */

#include "../threads.h"
#include <time.h>

#include <FBase.h>
#include <FSystem.h>

namespace liba
{
namespace threads
{

int interlocked_increment(counter_type * value)
{
	return ++(*value);
	//return __sync_fetch_and_add(value, 1);
}

int interlocked_decrement(counter_type * value)
{
	return --(*value);
	//return __sync_fetch_and_sub(value, 1);
}

void sleep(int time_ms)
{
	Osp::Base::Runtime::Thread::Sleep(time_ms);
}

__int64 get_precise_tick_count()
{
	long long result;
	Osp::System::SystemTime::GetTicks(result);
	return result;
}

double get_precise_tick_time()
{
	return 1.0/1000.0;
}

} //namespace threads
} //namespace liba
